package edu.washington.cs.sounddetector.server.api.methodresult;

import edu.washington.cs.sounddetector.server.api.MethodResult;
import edu.washington.cs.sounddetector.server.api.method.Untrain;

public class UntrainResult extends MethodResult<Untrain>
{

    private String message;

    private UntrainResult(boolean successful, FailureReason reason, String message)
    {
        super(successful, reason);
        this.message = message;
    }

    private UntrainResult()
    {
        this(true, null, null);
    }

    /**
     * @return if {@link #isSuccessful()} == true, returns null, else returns the message
     *         corresponding to the failure
     */
    public String getMessage()
    {
        return message;
    }

    public static UntrainResult success()
    {
        return new UntrainResult(true, null, null);
    }

    public static UntrainResult failureCantBuildClassifier(String message)
    {
        return new UntrainResult(false, FailureReason.CANT_BUILD_CLASSIFIER, message);
    }

}
